package com.zzc.study.controller;

import dev.langchain4j.model.chat.ChatLanguageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ChatLanguageModelController {
    @Autowired
    private ChatLanguageModel chatLanguageModel;



    // http://localhost:9003/chatconfig/config
    @GetMapping(value = "/chatconfig/config")
    public String hello(@RequestParam(value = "prompt", defaultValue = "你是谁") String prompt)
    {
        String result = chatLanguageModel.chat(prompt);

        System.out.println("通过langchain4j调用模型返回结果："+result);

        return result;
    }
}
